import { request } from '@pkg/request/src';

export enum Api {
  page = '/userGoods/page',
  getUserGoodsDetail = '/userGoods/get',
  update = '/userGoods/update',
  remove = '/userGoods/remove',
  backcardSub = '/userGoods/backcardSub',
  delaySub = '/userGoods/delaySub',
  userGoodsUpgradeSub = '/userGoods/userGoodsUpgradeSub',
  frozenSub = '/userGoods/frozenSub',
  syscAirport = '/userGoods/syscAirport',
  cancelSyscAirport = '/userGoods/cancelSyscAirport',
  nowRefundBackcardSub = '/userGoods/nowRefundBackcardSub',
  employeeUpdate = '/userGoods/employeeUpdate',
  upgradeUpdate = '/userGoods/upgradeUpdate',
  getUserPrivatedata = '/userPrivatedata/get',
  privateDataUpdate = '/userGoods/privateDataUpdate',
  addcheckRecord = '/addcheckRecord/save',
  userGoodsTagBlack = '/userGoods/userGoodsTagBlack',
  getVipcardAgreementUrl = '/userGoods/getVipcardAgreementUrl',
  getDataTagList = '/dataTag/list',
  importDataTag = '/userGoods/importDataTag',
  updateVipCardNo = '/userGoods/updateVipCardNo',
  checkUserGoodsCanChangeUser = '/userGoods/checkUserGoodsCanChangeUser',
  getUserGoodsChangeUserMobileCode = '/userGoods/getUserGoodsChangeUserMobileCode',
  userGoodsChangeUserSub = '/userGoods/userGoodsChangeUserSub',
  syscVipCardNoData = '/userGoods/syscVipCardNoData',
  sysDataToCooperationAirport = '/userGoods/sysDataToCooperationAirport',
  getUserGoodsConsumptionInfo = '/userGoods/getUserGoodsConsumptionInfo',
  tagFullDeduction = '/userGoods/tagFullDeduction',
}

enum PayWayApi {
  list = '/payway/list',
}

export const getUserGoodsDetail = params =>
  request.get(
    {
      url: Api.getUserGoodsDetail,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const update = params =>
  request.post(
    {
      url: Api.update,
      params: params,
    },
    { errorMessageMode: 'none' },
  );

export const remove = (ids: string) =>
  request.post(
    {
      url: Api.remove,
      params: { ids: ids },
    },
    { errorMessageMode: 'message' },
  );

export const payWayList = (ids: string) =>
  request.get(
    {
      url: PayWayApi.list,
      params: { ids: ids },
    },
    { errorMessageMode: 'none' },
  );

export const backcardSub = params =>
  request.post(
    {
      url: Api.backcardSub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const delaySub = params =>
  request.post(
    {
      url: Api.delaySub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const userGoodsUpgradeSub = params =>
  request.post(
    {
      url: Api.userGoodsUpgradeSub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const frozenSub = params =>
  request.post(
    {
      url: Api.frozenSub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const syscAirport = params =>
  request.post(
    {
      url: Api.syscAirport,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const cancelSyscAirport = params =>
  request.post(
    {
      url: Api.cancelSyscAirport,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const nowRefundBackcardSub = params =>
  request.post(
    {
      url: Api.nowRefundBackcardSub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const employeeUpdate = params =>
  request.post(
    {
      url: Api.employeeUpdate,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const upgradeUpdate = params =>
  request.post(
    {
      url: Api.upgradeUpdate,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const getUserPrivatedata = privateDataId =>
  request.get(
    {
      url: Api.getUserPrivatedata,
      params: { privateDataId: privateDataId },
    },
    { errorMessageMode: 'message', successMessageMode: 'none' },
  );

export const privateDataUpdate = params =>
  request.post(
    {
      url: Api.privateDataUpdate,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const addcheckRecord = params =>
  request.post(
    {
      url: Api.addcheckRecord,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const userGoodsTagBlack = params =>
  request.post(
    {
      url: Api.userGoodsTagBlack,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const getVipcardAgreementUrl = params =>
  request.get(
    {
      url: Api.getVipcardAgreementUrl,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const getDataTagList = params =>
  request.get(
    {
      url: Api.getDataTagList,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const updateVipCardNo = params =>
  request.post(
    {
      url: Api.updateVipCardNo,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const checkUserGoodsCanChangeUser = params =>
  request.post(
    {
      url: Api.checkUserGoodsCanChangeUser,
      params: params,
    },
    { errorMessageMode: 'message', successMessageMode: 'none' },
  );

export const getUserGoodsChangeUserMobileCode = params =>
  request.post(
    {
      url: Api.getUserGoodsChangeUserMobileCode,
      params: params,
    },
    { errorMessageMode: 'message', successMessageMode: 'none' },
  );
export const userGoodsChangeUserSub = params =>
  request.post(
    {
      url: Api.userGoodsChangeUserSub,
      params: params,
    },
    { errorMessageMode: 'message', successMessageMode: 'none' },
  );

export const syscVipCardNoData = params =>
  request.post(
    {
      url: Api.syscVipCardNoData,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const sysDataToCooperationAirport = params =>
  request.post(
    {
      url: Api.sysDataToCooperationAirport,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const getUserGoodsConsumptionInfo = params =>
  request.post(
    {
      url: Api.getUserGoodsConsumptionInfo,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const tagFullDeduction = params =>
  request.post(
    {
      url: Api.tagFullDeduction,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
